package com.base;

import java.util.TreeSet;

public class Testinterrupt2 {
    public  static  void main(String [] args) {

        final Thread thread= new Thread(new Runnable() {
            public void run() {
                while (true)
                {
                    if (Thread.currentThread().isInterrupted()==true)
                    {
                        System.out.println(Thread.currentThread().getName()+"is interrupt");
                    }
                    else if(Thread.currentThread().isInterrupted()==false)
                    {
                        System.out.println(Thread.currentThread().getName()+"is not interrupt");

                    }
                }

            }
        });
        thread.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread.interrupt();

    }
}
